package com.mijie.homi.dao.reports;

import java.util.HashMap;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.mijie.core.IBatisDao;
import com.mijie.homi.common.domain.reports.Crash;
import com.mijie.homi.common.domain.reports.Feedback;
import com.mijie.homi.common.domain.reports.Prosecute;
import com.mijie.homi.domain.commom.ProsecuteWarning;

@Repository
public class ReportDao extends IBatisDao{

	private Logger logger = Logger.getLogger(ReportDao.class);
	
	public int addFeedback(Feedback feedback){
		return this.insert("addFeedback", feedback);
	}
	
	public ProsecuteWarning getProsecuteWarning(int userId){
		return this.selectOne("getProsecuteWarning", userId);
	}
	
	public int updateProsecuteWarning(ProsecuteWarning warning){
		return this.insert("updateProsecuteWarning", warning);
	}
	
	public int markProsecuteWarned(int userId){
		return this.update("markProsecuteWarned", userId);
	}
	
	public int addCrash(Crash crash){
		return this.insert("addCrash", crash);
	}
	
	public int addProsecute(Prosecute prosecute){
		return this.insert("addProsecute",prosecute);
	}
	
	public String getProsecuteContentByTargetId(String tableName,String field,long id){
		HashMap<String,Object> parameter = new HashMap<String,Object>();
		parameter.put("tableName", tableName);
		parameter.put("field", field);
		parameter.put("id", id);
		return this.selectStr("getProsecuteContentByTargetId", parameter);
	}
}
